import { EventEmitter } from "events";

export interface CollectInfo {
    url: string,
    title: string,
    id: string,
    origin: string
}

export interface Element {
    content: string
    css: { [k: string]: string }
    classes: string[]
    animations: string[]
}

export interface Page {
    elements: Element[]
}

export interface Card {
    pages: Page[],
    title: string,
    origin: string
}

export interface _CollectEmitter extends EventEmitter {
    on(e: 'analysised', l: (c: CollectInfo) => void): this;
    on(e: 'fetched', l: (c: Card) => void): this;
    on(e: 'downloading', l: (c: Promise<string>[]) => void): this;
    on(e: 'downloaded', l: (c: string[]) => void): this;
    on(e: 'error', l: (c: Error) => void): this;
}


export class CollectEmitter extends EventEmitter implements _CollectEmitter {}